<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script>
    var json = {
        1: '1',
        2: '2',
        3:3
    }

    function flatten(json){
        var str='{';
        for(var i in json){
            str+=i+':'+json[i]+',';
        }
        str+='}';
        return str;
    }

    console.log(flatten(json));
</script>
</body>
</html>